package frege.control.trans.MonadIO where

{-- 
Monads in which 'IO' computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
'IO' monad will be an instance of this class.

Instances should satisfy the following laws, which state that 'liftIO'
is a transformer of monads:

'liftIO' <~ 'return' = 'return'

'liftIO' (m >>= f) = 'liftIO' m >>= ('liftIO' <~  f)

-}

class MonadIO Monad m => m where
  --- Lift a computation from the 'IO' monad.
  liftIO :: IO a -> m a

instance MonadIO IO where
  liftIO io = io
  return = ST.return
  (>>=)  = (ST.>>=)